﻿using System;
using System.Windows.Forms;
using BadgeManager.Controller;

namespace BadgeManager
{
    public partial class frmKeyGen : Form
    {
        public frmKeyGen()
        {
            InitializeComponent();
        }

        private void cmdAnnulla_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void cmdGenera_Click(object sender, EventArgs e)
        {
            if (txtCpuID.Text == "")
            {
                MessageBox.Show("Non hai inserito alcun codice di attivazione");
                return;
            }
            txtCdKey.Text = "" + AttivazioneSoftware.Encrypt(txtCpuID.Text, true);
        }

        private void txtCpuID_TextChanged(object sender, EventArgs e)
        {
            if (txtCpuID.Text.Length > 0)
                txtCdKey.Enabled = true;
            else
                txtCdKey.Enabled = false;
        }

        private void cmdCopia_Click(object sender, EventArgs e)
        {
            if (txtCdKey.Text == "") { return; }
            Clipboard.Clear();
            Clipboard.SetText(txtCdKey.Text);
        }
    }
}